<?php
include '../include/common.inc.php';
$adminhelp=new Adminhelp();
if(!$q=$adminhelp->mcheckol()){
    header("Location:".$C['SITE_URL']."/admin/login.php");
    exit;
}
$adminhelp->mupdatesession();
unset($q);
if($action=="delpic"){
    if(!$aid){
        echo '未指定aid';
    }
    $aid=(int)$aid;
    $q=$db->fetch_first("select * from attachment where aid = {$aid}");
    if($q){
        if(@unlink(ROOT.$C['attpath'].$q['path'])){
            $db->query("delete from attachment where aid = {$aid}");
            echo "删除成功";
            exit;
        }else{
            echo "文件不存在删除失败";
            exit;
        }
    }else{
        echo "附件不存在";
        exit;
    }
   
}else{
    exit;
}
